import React from 'react';
import ReactDOM from 'react-dom';

const root: HTMLElement | null = document.getElementById('root');

/*
因为jsx就是一个对象，So jsx可以作为方法的参数和返回值
*/
function greeting(name: string): React.ReactElement {
  if(name){
    return <h1>hello,{name}</h1>;
  }
  return <h1>Hello，陌生人</h1>
}

const ele = greeting('ahhh');

ReactDOM.render(
  ele
  , document.getElementById('root'));
